from langchain_core.prompts import ChatPromptTemplate
from langchain_core.output_parsers import StrOutputParser
from model_utils import getLLM

llm = getLLM()

template = ChatPromptTemplate(
    [("system","你是一名优秀的翻译官，将用户的信息翻译成{language}"),
    ("human","{content}")
])

parser = StrOutputParser()

chain = template | llm | parser#上一组的输出是下一组的输入
r = chain.invoke({"language":"英语","content":"我爱你三千遍"})
print(r)